﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Data;

namespace CMS.Converts
{
    public class StringToBool : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string a = "error";
            switch (value) {
                case true:a="入库"; break;
                case false:a="出库"; break;
            }
            return a;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool a = false;
            if (value is ComboBoxItem comboBoxItem)
            {
                switch (comboBoxItem.Content.ToString())
                {
                    case "出库": a = false; break;
                    case "入库": a = true; break;
                }
            }

            return a;
        }
    }
}
